home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / sgml / msdos / sgml07 / adl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-14  |  5.8 KB  |  113 lines

  1. /* ADL.H: Definitions for attribute descriptor list processing.
  2. */
  3. /* N/C/SDATA external entity types for nxetype member of ne structure. */
  4. #define ESNCDATA    1         /* External character data entity. */
  5. #define ESNNDATA    2         /* Non-SGML data entity. */
  6. #define ESNSDATA    3         /* External specific character data entity. */
  7. #define ESNSUB      4         /* SGML subdocument entity. */
  8.  
  9. /* N/C/SDATA control block for AENTITY attributes and NDATA returns.*/
  10. struct ne {                   /* N/C/SDATA entity control block. */
  11.      UNIV neid;               /* System file identifier of NDATA entity. */
  12.      PDCB nedcn;              /* Data content notation control block. */
  13.      struct ad *neal;         /* Data attribute list (NULL if none). */
  14.      UNCH *neename;           /* Ptr to entity name (length and EOS). */
  15.      UNCH nextype;            /* Entity type: NDATA SDATA CDATA SUBDOC. */
  16. };
  17. #define NESZ (sizeof(struct ne))
  18. typedef struct ne *PNE;
  19. /* NDATA entity control block fields. */
  20. #define NEID(p) (((PNE)p)->neid)            /* System ID of NDATA entity. */
  21. #define NEDCN(p) (((PNE)p)->nedcn->ename)   /* Data content notation name. */
  22. #define NEDCNID(p) (((PNE)p)->nedcn->dcnid) /* Data content notation full ID.*/
  23. #define NEDCNADL(p) (((PNE)p)->nedcn->dcnadl)/* Data content notation attlist.*/
  24. #define NEENAME(p) (((PNE)p)->neename)      /* Entity name pointer. */
  25. #define NEXTYPE(p) (((PNE)p)->nextype)      /* External entity type. */
  26. #define NEAL(p) (((PNE)p)->neal)            /* Data attributes (if any). */
  27. #define NEDCNMARK(p) DCNMARK(((PNE)p)->nedcn)
  28.  
  29. /* Attribute descriptor list entry. */
  30. struct ad {
  31.      UNCH *adname;          /* Attribute name with length and EOS. */
  32.      UNCH adflags;            /* Attribute flags. */
  33.      UNCH adtype;             /* Value type. */
  34.      UNS adnum;               /* Group size or member pos in grp. */
  35.      UNS adlen;               /* Length of default or value (for capacity). */
  36.      UNCH *addef;             /* Default value (NULL if REQUIRED or IMPLIED). */
  37.      union {
  38.           PNE n;              /* AENTITY: NDATA control block. */
  39.           PDCB x;             /* ANOTEGRP: DCN control block. */
  40.      } addata;                /* Special data associated with some attributes.*/
  41. };
  42. #define ADSZ (sizeof(struct ad))   /* Size of an ad structure. */
  43.  
  44. /* Attribute flags for entire list adflags: ADLF. */
  45. #define ADLREQ    0x80        /* Attribute list: 1=REQUIRED att defined. */
  46. #define ADLNOTE   0x40        /* Attribute list: 1=NOTATION att defined. */
  47. #define ADLCONR   0x20        /* Attribute list: 1=CONREF att defined. */
  48.  
  49. /* Attribute flags for list member adflags: ADFLAGS(n). */
  50. #define AREQ      0x80        /* Attribute: 0=null; 1=required. */
  51. #define ACURRENT  0x40        /* Attribute: 0=normal; 1=current. */
  52. #define AFIXED    0x20        /* Attribute: 0=normal; 1=must equal default. */
  53. #define AGROUP    0x10        /* Attribute: 0=single; 1=group of ad's. */
  54. #define ACONREF   0x08        /* Attribute: 0=normal; 1=att is CONREF. */
  55. #define AINVALID  0x04        /* Attribute: 1=value is invalid; 0=o.k. */
  56. #define AERROR    0x02        /* Attribute: 1=error was specified; 0=o.k. */
  57. #define ASPEC     0x01        /* Attribute: 1=value was specified; 0=default. */
  58.  
  59. /* Attribute types for adtype. */
  60. #define ANMTGRP   0x00        /* Attribute: Name token group or member. */
  61. #define ANOTEGRP  0x01        /* Attribute: Notation (name group). */
  62. #define ACHARS    0x02        /* Attribute: Character string. */
  63. #define AENTITY   0x03        /* Attribute: Data entity (name). */
  64. #define AID       0x04        /* Attribute: ID value (name). */
  65. #define AIDREF    0x05        /* Attribute: ID reference value (name). */
  66. #define ANAME     0x06        /* Attribute: Name. */
  67. #define ANMTOKE   0x07        /* Attribute: Name token. */
  68. #define ANUMBER   0x08        /* Attribute: Number. */
  69. #define ANUTOKE   0x09        /* Attribute: Number token. */
  70. #define ATKNLIST  0x0A        /* Attribute: >= means value is a token list. */
  71. #define AENTITYS  0x0A        /* Attribute: Data entities (name list). */
  72. #define AIDREFS   0x0B        /* Attribute: ID reference value (name list). */
  73. #define ANAMES    0x0C        /* Attribute: Name list. */
  74. #define ANMTOKES  0x0D        /* Attribute: Name token list. */
  75. #define ANUMBERS  0x0E        /* Attribute: Number list. */
  76. #define ANUTOKES  0x0F        /* Attribute: Number token list. */
  77.  
  78. /* Field definitions for entries in an attribute list.
  79.    The first argument to all of these is the list address.
  80. */
  81. /* Attribute list: flags. */
  82. #define ADLF(a) ((a)[0].adflags)
  83. /* Attribute list: number of list members. */
  84. #define ADN(a) ((a)[0].adtype)
  85. /* Attribute list: number of attributes. */
  86. #define AN(a) ((a)[0].adnum)
  87. /* Nth attribute in list: name. */
  88. #define ADNAME(a, n) (((a)[n].adname+1))
  89. /* Nth att in list: number of val)ues. */
  90. #define ADNUM(a, n) ((a)[n].adnum)
  91. /* Nth attribute in list: flags. */
  92. #define ADFLAGS(a, n) ((a)[n].adflags)
  93. /* Nth attribute in list: type. */
  94. #define ADTYPE(a, n) ((a)[n].adtype)
  95. /* Nth attribute in list: len of def or val.*/
  96. #define ADLEN(a, n) ((a)[n].adlen)
  97. /* Nth attribute in list: def or value. */
  98. #define ADVAL(a, n) ((a)[n].addef)
  99. /* Nth attribute in list: special data. */
  100. #define ADDATA(a, n) ((a)[n].addata)
  101. /* Nth att: token at Pth pos in value. */
  102. #define ADTOKEN(a, n, p)(((a)[n].addef+(p)))
  103.  
  104. #define IDHASH 101            /* Size of ID hash table.  Must be prime. */
  105. struct id {                   /* ID attribute control block. */
  106.      struct id *idnext;       /* Next ID in chain. */
  107.      UNCH *idname;          /* ID name with length prefix and EOS. */
  108.      UNCH iddefed;          /* Non-zero if it has been defined. */
  109.      struct fwdref *idrl;     /* Chain of forward references to this ID. */
  110. };
  111. #define IDSZ sizeof(struct id)
  112. typedef struct id *PID;       /* Ptr to ID attribute control block. */
  113.